package com.bang.study.day02.set;

import com.bang.study.day02.tree.BinarySearchTree;

/**
 * @Auther: Bang
 * @Date: 2019/9/12 23:57
 * @Description: 以二叉搜索树为底层实现set集合
 */
public class BSTSet<E extends Comparable<E>> implements Set<E> {

    private BinarySearchTree<E> tree;

    public BSTSet() {
        this.tree = new BinarySearchTree();
    }

    @Override
    public void add(E e) {
        tree.add(e);
    }

    @Override
    public void remove(E e) {
        tree.remove(e);
    }

    @Override
    public int getSize() {
        return tree.getSize();
    }

    @Override
    public boolean isEmpty() {
        return tree.isEmpty();
    }

    @Override
    public boolean contains(E e) {
        return tree.contains(e);
    }
}
